import { findTypeByValue, findTypeByLabel } from "@/utils/findType"
import * as types from "./types"

// 渠道Table
export const configTableFrame = [
  { 
    prop: "num", 
    label: "序号", 
    minWidth: "50px", 
    tooltip: true 
  },
  {
    prop: "name",
    label: "名称",
    minWidth: "150px"
  },
  {
    prop: "labelList",
    label: "标签列表",
    minWidth: "150px",
    formatter: (row) => {
      if(row.labelList && row.labelList.length > 0){
        return row.labelList.join("、")
      }
      return row.labelList
    }
  },
  {
    prop: "problemList",
    label: "常见问题",
    minWidth: "150px",
    formatter: (row) => {
      if(row.problemList && row.problemList.length > 0){
        return row.problemList.join("、")
      }
      return row.problemList
    }
  },
  {
    prop: "kvalue",
    label: "appKey",
    minWidth: "100px"
  },
  {
    prop: "isHot",
    label: "是否热门",
    minWidth: "100px",
    formatter: (row) => {
      return findTypeByValue(row.isHot, types.isHotest);
    }
  },
  // {
  //   prop: "enabled",
  //   label: "启用",
  //   minWidth: "100px",
  //   formatter: (row) => {
  //     return findTypeByValue(row.enabled, types.enableType);
  //   }
  // },
  { 
    label: "操作", 
    slotName: "operate", 
    fixed: "right",
    minWidth: "150px"
  },
];


export const searchFrame = [
  { 
    label: "名称", 
    key: "name", 
    type: 1 
  }
]